// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//
#include <pollux/expression/special_form_registry.h>
#include <pollux/functions/lib/registration_helpers.h>
#include <pollux/functions/sparksql/in.h>
#include <pollux/functions/sparksql/monotonically_increasing_id.h>
#include <pollux/functions/sparksql/raise_error.h>
#include <pollux/functions/sparksql/spark_partition_id.h>
#include <pollux/functions/sparksql/unscaled_value_function.h>
#include <pollux/functions/sparksql/uuid.h>

namespace kumo::pollux::functions::sparksql {
    void registerMiscFunctions(const std::string &prefix) {
        register_function<MonotonicallyIncreasingIdFunction, int64_t>(
            {prefix + "monotonically_increasing_id"});
        register_function<RaiseErrorFunction, UnknownValue, Varchar>(
            {prefix + "raise_error"});
        register_function<SparkPartitionIdFunction, int32_t>(
            {prefix + "spark_partition_id"});
        registerIn(prefix);
        exec::registerVectorFunction(
            prefix + "unscaled_value",
            unscaledValueSignatures(),
            makeUnscaledValue());
        register_function<UuidFunction, Varchar, Constant<int64_t> >({prefix + "uuid"});
    }
} // namespace kumo::pollux::functions::sparksql
